package xp.ass.imitate.express.impl;

import lombok.Data;
import org.springframework.lang.NonNull;
import xp.ass.imitate.express.XEvaluateContext;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @author chent3
 * @date 2024/9/6
 */
@Data
public class XEvaluateContextImpl implements XEvaluateContext {

    private Object rootObject;

    private Map<String, Object> variableMap = new ConcurrentHashMap<>();

    @Override
    public void setVariable(@NonNull String name, @NonNull Object value) {
        this.variableMap.put(name, value);
    }

    @Override
    public Object lookupVariable(String name) {
        return this.variableMap.get(name);
    }


}
